<?php

/** Gpc_Controller_BaseStatsModel */
require_once('Gpc/Controller/BaseStatsModel.php');

class Admin_ClassController extends Gpc_Controller_BaseStatsModel  {

   /**
    * Initiaizes this controler specific variables.
    */
   public function init() {
      $this->modelName = 'Classes';
      $this->returnController = 'toon';
      $this->returnAction = 'raceclass';
   }

   /**
    * Filters and validates data for the `classes` table.
    *
    * @return array Returns an array of stats data after filtering.
    */
   protected function _filter() {
      /* Validation Process */
      $filters = array ( 'class_name' => 'StringTrim' );
      $validators = array('class_name' => array(array('alpha', true), 'presence' => 'required') );

      /*
       * Validate input
       *  -- I would prefer a more built in way to validate input, vs uses the actual
       *     super global.
       */
      $input = new Zend_Filter_Input($filters, $validators, $this->getRequest()->getParams());

      if ( ! $input->isValid( ) ) { // Insure it's valid input.
         throw new Exception('Invalid input for _filter(): ' . print_r($input->getMessages(), true), -432);
      }

      /* Build data array for passing to model class */
      $data = array ( 'name' => $input->class_name );

      return $data;
   }

}
